﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using com.huigo.Framework.ServiceUtils;

namespace com.huigo.B2B.Web.center.invoice
{

    public partial class InvoiceOrderSucceed : BasePage
    {
        public long orderId
        {
            get
            {
                string classId = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(classId))
                {
                    try
                    {
                        return int.Parse(classId);
                    }
                    catch
                    {
                        return 0;
                    }
                }
                else
                {
                    return 0;
                }
            }
        }
        public string orderNo = string.Empty;
        public decimal orderPayAmount = 0;
        public string payBtn = string.Empty;
        protected void Page_Load(object sender, EventArgs e)
        {            
            if (orderId > 0)
            {
                List<RequestFuncParams> list = new List<RequestFuncParams>();
                list.Add(new RequestFuncParams("custFid", CustId.ToString()));
                list.Add(new RequestFuncParams("orderId", orderId.ToString()));
                BaseService service = new BaseService();
                ParserXml parser = service.RequestEntryService(Dict.ERequestFunc.GET_INVOICE_ORDER_INFO_BY_ID, list);
                if (parser != null && parser.RowsCount > 0)
                {
                    orderNo = parser["OrderNo", 0];
                    orderPayAmount = Convert.ToDecimal(parser["OrderPayAmount", 0]);
                    if (orderPayAmount > 0)
                    {
                        payBtn = "<input type=\"button\" value=\"立即支付\" id=\"btn_pay\" onclick=\"location.href='/center/pay.aspx?pid=" + orderId + "'\" />";
                    }
                    else
                    {
                        payBtn = string.Empty;
                    }
                }
            }
        }
    }
}
